<script setup>
import { ref, inject, onMounted } from 'vue'
import { useStore } from '@/store/index';
defineProps(['title', 'mod'])
let emit = defineEmits(['update:mod'])

const inc = inject('pvde')
const parentFn = inject('fn');
const store = useStore()
onMounted(() => {
  parentFn()
})

function mod() {
  emit('update:mod', 'model')
}

</script>

<template>
  <div class="f">
    <span>{{ title }}</span>
    <span>{{ inc }}</span>
    <span>pinia:{{ store.pin }}</span>
    <span><button @click="mod" v-if="1">v-model</button></span>
    <button @click="callParentFn">调用父组件方法</button>
  </div>
</template>

<style scoped>
.f {
  display: flex;
  flex-direction: column;
}
</style>